package cn.com.cym.gamezao.entity;

import cn.com.cym.gamezao.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.io.Serializable;

@Getter
@Setter
@NoArgsConstructor
@Entity
@Accessors(chain = true)
@Table(name ="x_dict_item")
@ApiModel(description = "字典子类")
public class DictItem extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 7526011926295378770L;
    @Column(length = 20)
    @ApiModelProperty(value = "代码",required = true,dataType = "String")
    private String code;

    @Column(length = 200)
    @ApiModelProperty(value = "名称",required = true,dataType = "String")
    private String name;

    /**
     * JsonIgnore 防止无限递归
     */
    @ManyToOne
    @JoinColumn(name = "dict_id")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Dict dict;
}
